package dry.example.demo02;

import java.util.function.BiConsumer;

/**
 * @author zc
 */
public class MethodPassingExample {

    public static void yeWuCode(BiConsumer<Integer, Integer> callback) {
        callback.accept(10, 90);
    }

    public static void printSum(Integer a, Integer b) {
        System.out.println("Sum1=" + (a + b));
    }

    public static void main(String[] args) {
        //调用业务代码，业务代码执行完成后执行传入的回调方法
        yeWuCode(MethodPassingExample::printSum);
        yeWuCode((a, b) -> System.out.println("Sum2=" + (a + b)));
    }

}
